ScrollBar
| Kind of class: | class |
|---|---|
| Inherits from: | ScrollIndicator < UIComponent < MovieClip |
| Classpath: | gfx.controls.ScrollBar |
| File last modified: | Tuesday, 29 June 2010, 09:03:27 |
The CLIK ScrollBar displays and controls the scroll position of another component. It adds interactivity to the ScrollIndicator with a draggable thumb button, as well as optional “up” and “down” arrow buttons, and a clickable track.
Inspectable Properties
The inspectable properties of the ScrollBar are similar to ScrollIndicator with one addition:
The ScrollBar, similar to the ScrollIndicator, does not have explicit states. It uses the states of its child elements, the thumb, up, down and track Button components.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
Inspectable Properties
The inspectable properties of the ScrollBar are similar to ScrollIndicator with one addition:
- scrollTarget: Set a TextArea or normal multiline textField as the scroll target to automatically respond to scroll events. Non-text field types have to manually update the ScrollIndicator properties.
- trackMode: When the user clicks on the track with the cursor, the scrollPage setting will cause the thumb to continuously scroll by a page until the cursor is released. The scrollToCursor setting will cause the thumb to immediately jump to the cursor and will also transition the thumb into a dragging mode until the cursor is released.
- visible: Hides the component if set to false.
- disabled: Disables the component if set to true.
- offsetTop: Thumb offset at the top. A positive value moves the thumb's top-most position higher.
- offsetBottom: Thumb offset at the bottom. A positive value moves the thumb's bottom-most position lower.
- enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
- soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects.
The ScrollBar, similar to the ScrollIndicator, does not have explicit states. It uses the states of its child elements, the thumb, up, down and track Button components.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
- type: The event type.
- target: The target that generated the event.
- show: The component’s visible property has been set to true at runtime.
- hide: The component’s visible property has been set to false at runtime.
- scroll: The scroll position has changed.
- position: The new scroll position. Number type. Values minimum position to maximum position.
Component metadata:
| InspectableList | "disabled" "enableInitCallback" "inspectableScrollTarget" "offsetBottom" "offsetTop" "soundMap" "trackMode" "visible" |
|---|
Summary
Constructor
Instance properties
- trackScrollPageSize
- The number of positions to scroll when the track is clicked in scrollPage mode
- upArrow
- A reference to the up arrow symbol in the ScrollBar, used to decrement the scroll position.
- downArrow
- A reference to the down arrow symbol in the ScrollBar, used to increment the scroll position.
- thumb
- A reference to the thumb symbol in the ScrollBar, used to display the scrollPosition, as well as change it by dragging.
- track
- A reference to the track symbol in the ScrollBar, used to determine the thumb's range, as well as jump to a position when clicked.
- disabled
- Disable this component.
- position
- Set the scroll position to a number between the minimum and maximum.
- trackMode
- Set the behavior when clicking on the track.
Instance properties inherited from ScrollIndicator
Instance properties inherited from UIComponent
__height __width _disabled _displayFocus _focused addEventListener cleanUpEvents disabled dispatchEvent displayFocus enableInitCallback focused focusHandlerReference focusTarget hasEventListener height initialized invalidationIntervalID removeAllEventListeners removeEventListener sizeIsInvalid soundMap visible width
Class methods
Class methods inherited from UIComponent
Instance methods
Instance methods inherited from ScrollIndicator
Instance methods inherited from UIComponent
Constructor
ScrollBar
function ScrollBar (
)
The constructor is called when a ScrollBar or a sub-class of ScrollBar is instantiated on stage or by using
attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend ScrollBar, ensure that a super() call is made first in the constructor. Instance properties
disabled
disabled:Boolean
(read,write)
Disable this component. Focus (along with keyboard events) and mouse events will be suppressed if disabled.
downArrow
A reference to the down arrow symbol in the ScrollBar, used to increment the scroll position.
position
position:Number
(read,write)
Set the scroll position to a number between the minimum and maximum.
thumb
A reference to the thumb symbol in the ScrollBar, used to display the scrollPosition, as well as change it by dragging.
track
A reference to the track symbol in the ScrollBar, used to determine the thumb's range, as well as jump to a position when clicked.
trackMode
trackMode:String
(read,write)
Set the behavior when clicking on the track. The scrollPage value will move the grip by a page in the direction of the click. The scrollToCursor value will move the grip to the exact position that was clicked and become instantly draggable.
trackScrollPageSize
trackScrollPageSize:Number = 1
(read,write)
The number of positions to scroll when the track is clicked in scrollPage mode
upArrow
A reference to the up arrow symbol in the ScrollBar, used to decrement the scroll position.